package com.example.demo.lab2.service.impl;

import com.example.demo.lab2.entity.DepWithEmp;
import com.example.demo.lab2.entity.Departments;
import com.example.demo.lab2.mapper.DepartmentsMapper;
import com.example.demo.lab2.service.DepartmentsService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.math.BigDecimal;
import java.util.List;

@Service
public class DepartmentsServiceImpl implements DepartmentsService {
    @Autowired
    private DepartmentsMapper departmentsMapper;
    @Override
    public int insert(Departments department) {
        int insert = departmentsMapper.insert(department);
        return insert;
    }

    @Override
    public int delete(BigDecimal id) {
        int delete = departmentsMapper.delete(id);
        return delete;
    }

    @Override
    public int update(Departments department) {
        int update = departmentsMapper.update(department);
        return update;
    }

    @Override
    public List<Departments> list() {
        List<Departments> departmentsList = departmentsMapper.list();
        return departmentsList;
    }

    @Override
    public List<DepWithEmp> listWithEmp() {
        return departmentsMapper.listWithEmp();
    }
}
